/******************************************************************************
 * Copyright (C) 2024 EternalChip, Inc.(Gmbh) or its affiliates.
 * 
 * All Rights Reserved.
 * 
 * @file bsp_key.c
 * 
 * @par dependencies 
 * - stdio.h
 * - stdint.h
 * 
 * @author Jack | R&D Dept. | EternalChip 立芯嵌入式
 * 
 * @brief Provide the HAL APIs of LED and corresponding opetions.
 * 
 * Processing flow:
 * 
 * call directly.
 * 
 * @version V1.0 2024-11-26
 *
 * @note 1 tab == 2 spaces!
 * 
 *****************************************************************************/
#ifndef __BAP_LED_H__
#define __BAP_LED_H__

//******************************** Includes *********************************//
#include <stdint.h>
#include <stdio.h>

#include "usart.h"
#include "stm32f4xx_hal.h"

#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"

// #include "bsp_key.h"
#include "bsp_key_irq.h"
//******************************** END Includes *****************************//


//******************************** Defines **********************************//

// #define BLUE_LED_Pin        GPIO_PIN_13
// #define BLUE_LED_GPIO_Port  GPIOC

/*  函数返回状态枚举                    */
typedef enum _led_status_t
{
  LED_OK                = 0,              /* Operation completed successfully.  */
  LED_ERROR             = 1,              /* Run-time error without case matched*/
  LED_ERRORTIMEOUT      = 2,              /* Operation failed with timeout      */
  LED_ERRORRESOURCE     = 3,              /* Resource not available.            */
  LED_ERRORPARAMETER    = 4,              /* Parameter error.                   */
  LED_ERRORNOMEMORY     = 5,              /* Out of memory.                     */
  LED_ERRORISR          = 6,              /* Not allowed in ISR context         */
  LED_RESERVED          = 0x7FFFFFFF      /* Reserved                           */
} led_status_t;

typedef enum _led_opration_t
{
  LED_ON,
  LED_OFF,
  LED_TOGGLE,
  LED_BLINK,
  LED_BLINK_10_TIMES,
} led_opration_t;

//******************************** END Defines ********************************//


//******************************** Declaring ********************************//
extern xQueueHandle LED_Queue;

void LED_Task(void *argument);
led_status_t led_opration(led_opration_t opt);
led_status_t led_callback_in_timer(void);
//******************************** END Declaring ****************************//
#endif
